clog = str => console.log(str)
function DumpFormData(form){
	var result = {}
	form.find("input").toArray().forEach((object)=>result[object.name]=object.value)
	form.find("textarea").toArray().forEach((object)=>result[object.name]=object.value)
	return result
}
function RenderSemanticUI(){
	$('.ui.dropdown').dropdown()
}

var root = {}

function LoadRootData(){
	root = JSON.parse(window.localStorage.getItem('content'))
}
function SaveRootData(){
	window.localStorage.setItem('content',JSON.stringify(root))
}
function InitLocalStorageOnFirstLaunch(){
	window.localStorage.setItem('inited','1')
	window.root = {
		'notebook': {"list":[]},
		'novel': {"on_page":1}
	}
	SaveRootData()
}

function InitCore(){
	if( window.localStorage.getItem('inited') != '1' )
		InitLocalStorageOnFirstLaunch()
	LoadRootData()
}
